package com.angus.common.core.enums;


import lombok.Getter;

@Getter
public enum PayMethod {

    ALIPAY(1,"alipay", "支付宝"),
    WXPAY(2, "wxpay","微信"),
    PAYPAL(3, "paypal","paypal");




    private final Integer typeFlag;
    private final String typeCode;
    private final String typeName;

    PayMethod(Integer typeFlag, String typeCode, String typeName) {
        this.typeFlag = typeFlag;
        this.typeCode = typeCode;
        this.typeName = typeName;
    }

    public static String fromFlag(Integer typeFlag) {
        PayMethod[] values = PayMethod.values();
        for (PayMethod value : values) {
            if (value.getTypeFlag().equals(typeFlag)) {
                return value.getTypeCode();
            }
        }
        return "UNKNOWN";
    }

}
